<?php

/**
 * Payment form base class.
 *
 * @package    form
 * @subpackage payment
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BasePaymentForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'case_type'   => new sfWidgetFormChoice(array('choices' => array('regular' => 'regular', 'with AJM' => 'with AJM', 'with MJS' => 'with MJS'))),
      'credit_line' => new sfWidgetFormChoice(array('choices' => array('BSP terms' => 'BSP terms', 'for deposit' => 'for deposit', 'guarantee check' => 'guarantee check'))),
      'days'        => new sfWidgetFormInput(),
      'person_id'   => new sfWidgetFormDoctrineChoice(array('model' => 'Person', 'add_empty' => true)),
      'client_id'   => new sfWidgetFormDoctrineChoice(array('model' => 'Client', 'add_empty' => true)),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorDoctrineChoice(array('model' => 'Payment', 'column' => 'id', 'required' => false)),
      'case_type'   => new sfValidatorChoice(array('choices' => array('regular' => 'regular', 'with AJM' => 'with AJM', 'with MJS' => 'with MJS'), 'required' => false)),
      'credit_line' => new sfValidatorChoice(array('choices' => array('BSP terms' => 'BSP terms', 'for deposit' => 'for deposit', 'guarantee check' => 'guarantee check'), 'required' => false)),
      'days'        => new sfValidatorInteger(array('required' => false)),
      'person_id'   => new sfValidatorDoctrineChoice(array('model' => 'Person', 'required' => false)),
      'client_id'   => new sfValidatorDoctrineChoice(array('model' => 'Client', 'required' => false)),
      'created_at'  => new sfValidatorDateTime(array('required' => false)),
      'updated_at'  => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('payment[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Payment';
  }

}
